from langchain_core.runnables import RunnableLambda


def counter(chain_input, state={"count": 0}):
    state["count"] += 1
    return {"chain_input": chain_input, "count": state["count"]}


result_chain = RunnableLambda(counter)
print(result_chain)
print(type(result_chain))

result1 = result_chain.invoke("zuozhu")
print(type(result1), result1)
result2 = result_chain.invoke("xiaoyin")
print(type(result2), result2)
